create or replace view vac_app_themes_4_1 as
with ath as
(
 select
  WORKSPACE,
  WORKSPACE_DISPLAY_NAME,
  APPLICATION_ID,
  APPLICATION_NAME,
  THEME_NUMBER,
  THEME_NAME,
  DEFAULT_PAGE_TEMPLATE,
  DEFAULT_BUTTON_TEMPLATE,
  DEFAULT_REGION_TEMPLATE,
  DEFAULT_CHART_RG_TEMPLATE,
  DEFAULT_FORM_RG_TEMPLATE,
  DEFAULT_REPORT_REGION_TEMPLATE,
  DEFAULT_TABULAR_FORM_TEMPLATE,
  DEFAULT_WIZARD_TEMPLATE,
  DEFAULT_BREADCRUMB_RG_TEMPLATE,
  DEFAULT_LIST_REGION_TEMPLATE,
  DEFAULT_IRR_TEMPLATE,
  DEFAULT_REPORT_ROW_TEMPLATE,
  DEFAULT_ITEM_LABEL_TEMPLATE,
  DEFAULT_BREADCRUMB_TEMPLATE,
  DEFAULT_CALENDAR_TEMPLATE,
  DEFAULT_LIST_TEMPLATE,
  DEFAULT_OPTION_LABEL,
  DEFAULT_REQUIRED_LABEL,
  MOBILE_LOGIN_TEMPLATE,
  MOBILE_PAGE_TEMPLATE,
  MOBILE_REGION_TEMPLATE,
  MOBILE_LIST_TEMPLATE,
  MOBILE_REPORT_TEMPLATE,
  MOBILE_CALENDAR_TEMPLATE,
  MOBILE_BUTTON_TEMPLATE,
  MOBILE_REQUIRED_LABEL,
  MOBILE_OPTIONAL_LABEL,
  LAST_UPDATED_ON,
  LAST_UPDATED_BY,
  CALENDAR_ICON_IMAGE_NAME,
  CALENDAR_ICON_ATTRIBUTES,
  THEME_ID,
  THEME_DESCRIPTION,
  COMPONENT_SIGNATURE
 from APEX_APPLICATION_THEMES
)
select
  WORKSPACE,
  WORKSPACE_DISPLAY_NAME,
  to_char(THEME_NUMBER) THEME_NUMBER,
  THEME_NAME,
  APPLICATION_ID,
  APPLICATION_NAME,
  LAST_UPDATED_ON,
  LAST_UPDATED_BY,
  CALENDAR_ICON_IMAGE_NAME,
  CALENDAR_ICON_ATTRIBUTES,
  THEME_ID,
  THEME_DESCRIPTION,
  COMPONENT_SIGNATURE,
  u_name,
  u_value,
  'APEX_APPLICATION_THEMES' src_view_name
from ath
 UNPIVOT INCLUDE NULLS
  (u_value FOR u_name IN
   (DEFAULT_PAGE_TEMPLATE,
    DEFAULT_BUTTON_TEMPLATE,
    DEFAULT_REGION_TEMPLATE,
    DEFAULT_CHART_RG_TEMPLATE,
    DEFAULT_FORM_RG_TEMPLATE,
    DEFAULT_REPORT_REGION_TEMPLATE,
    DEFAULT_TABULAR_FORM_TEMPLATE,
    DEFAULT_WIZARD_TEMPLATE,
    DEFAULT_BREADCRUMB_RG_TEMPLATE,
    DEFAULT_LIST_REGION_TEMPLATE,
    DEFAULT_IRR_TEMPLATE,
    DEFAULT_REPORT_ROW_TEMPLATE,
    DEFAULT_ITEM_LABEL_TEMPLATE,
    DEFAULT_BREADCRUMB_TEMPLATE,
    DEFAULT_CALENDAR_TEMPLATE,
    DEFAULT_LIST_TEMPLATE,
    DEFAULT_OPTION_LABEL,
    DEFAULT_REQUIRED_LABEL,
    MOBILE_LOGIN_TEMPLATE,
    MOBILE_PAGE_TEMPLATE,
    MOBILE_REGION_TEMPLATE,
    MOBILE_LIST_TEMPLATE,
    MOBILE_REPORT_TEMPLATE,
    MOBILE_CALENDAR_TEMPLATE,
    MOBILE_BUTTON_TEMPLATE,
    MOBILE_REQUIRED_LABEL,
    MOBILE_OPTIONAL_LABEL
   )
  );

